package com.vcs.interceptors;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class AuthInterceptor implements Interceptor {

	private static final long serialVersionUID = 1L;
	Log log = LogFactory.getLog(AuthInterceptor.class);

	@Override
	public void destroy() {
		// TODO Auto-generated method stub

	}

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		Action action = (Action)invocation.getAction();
		Map session = invocation.getInvocationContext().getSession();
		
		log.info("***AUTHENTICATION INTERCPETOR EXECUTED***");
		log.info(action.getClass());
		log.info(invocation.getAction());
		log.info("***Action name: "+invocation.getInvocationContext().ACTION_NAME);
		log.info(invocation.getStack().findValue("request"));
		log.info(invocation.toString());
		log.info("***AUTHENTICATION INTERCPETOR EXECUTED***");
		return invocation.invoke();
	}

}
